/**
 * @fileoverview Provide console functionality to Mimic extensions.
 *
 * Consider making this more accurate and useful.  Check to see FireBug
 * functionality is available and preferentially use it.  Otherwise, check to
 * see if someone has defined them and preferentially use it.  Finally, if a
 * function doesn't exist, add this variant.
 *
 * Functions must be exported as they are used within an extension's sandbox.
 *
 * @author jasonstredwick@google.com (Jason Stredwick)
 */


goog.provide('console');


/**
 * Adds a message to the console's log.
 * @param {string} msg The message to log.
 * @export
 */
console.log = function(msg) {
  // Access the console service for logging messages.
  var componentClass = Components.classes['@mozilla.org/consoleservice;1'];
  var serviceInterface = Components.interfaces.nsIConsoleService;
  var service = componentClass.getService(serviceInterface);
  service.logStringMessage(msg);
};


/**
 * Adds a message to the console's error log.
 * @param {string} msg The message to log.
 * @export
 */
console.error = function(msg) {
  Components.utils.reportError(msg);
};

